//
//  YNBroadcastNotificationChat.h
//  Messenger
//
//  Created by iOS on 15/6/15.
//  Copyright (c) 2015年 YN-APP-iOS. All rights reserved.
//
//  广播通知表(模型)
//

#import <Foundation/Foundation.h>
@class FMDatabase;

@interface YNBroadcastNotificationChat : NSObject

//消息ID (主键)
@property (nonatomic, strong) NSString *packetId;

//主题
@property (nonatomic, strong) NSString *subject;

//发送者
@property (nonatomic, strong) NSString *fromUserNo;

//接收者
@property (nonatomic, strong) NSString *toUserNo;

//消息内容 (content)
@property (nonatomic, strong) NSString *content;

//消息链接
@property (nonatomic, strong) NSString *link;

//接收的时间
@property (nonatomic, strong) NSString *mTime;

//发送者的名字
@property (nonatomic, strong) NSString *senderName;

//具体发送给了哪些人的Json字符串(目前先不赋值)
@property (nonatomic, strong) NSString *recipient;

////头像Url
//@property (nonatomic, strong) NSString *headerUrl;

//广播消息类型(0:告知类 1:异常类 2：待办)
@property (nonatomic)         int      broadcastNotificationType;

//来源终端(0:YNedut8 1:企业信息化)
@property (nonatomic)         int      sourceTerminal;

//广播通知消息是否已读还是未读
@property (nonatomic)         int      isRead;

//创建广播通知表
+ (BOOL)creatBroadcastNotificationTableInDatabase:(FMDatabase *)db;

//保存广播通知消息
- (BOOL)insertBroadcastNotificationInDatabase:(FMDatabase *)db;

/**
 *  清空对应类型的广播通知
 *  @pram typeArray    广播通知的类型数组
 */
+ (BOOL)deleteBroadcastWithNotificationTypeArray:(NSArray *)typeArray  inDatabase:(FMDatabase *)db;

//删除某一个广播通知
+ (BOOL)deleteBroadcastNotificationWithPacketId:(NSString *)packetId inDatabase:(FMDatabase *)db;

//根据广播通知的类型查询数据
+ (NSArray *)queryBroadcastNotificationWithType:(int)broadcastNotificationType inDatabase:(FMDatabase *)db;

//查询未读通知
+ (NSArray *)queryUnReadBroadcastNotificationWithType:(int)broadcastNotificationType inDatabase:(FMDatabase *)db;

//更新未读通知为已读
+ (BOOL)updateBroadcastNotificationWithType:(int)broadcastNotificationType inDatabase:(FMDatabase *)db;

//更新一条未读通知为已读
+ (BOOL)updateOneBroadcastNotificationWithPacketId:(NSString *)packetId inDatabase:(FMDatabase *)db;

@end
